package sk.naive.talker.command;

import sk.naive.talker.props.PropertyStoreException;

import java.rmi.RemoteException;

/**
 * Command with optional parameter string.
 *
 * @author <a href="mailto:virgo@naive.deepblue.sk">Richard "Virgo" Richter</a>
 * @version $Revision: 1.4 $ $Date: 2005/01/08 14:17:35 $
 */
public abstract class OptionalParameterCommand extends AbstractCommand {
	public final void exec()
		throws CommandException, RemoteException, PropertyStoreException
	{
		if (params == null || params.length() == 0) {
			execWithoutParameter();
		} else {
			execWithParameter();
		}
	}

	protected abstract void execWithoutParameter() throws RemoteException, CommandException;

	protected abstract void execWithParameter() throws RemoteException, CommandException, PropertyStoreException;
}
